package cn.lanqiao.springboot.mapper;

import cn.lanqiao.springboot.entity.Role;
import cn.lanqiao.springboot.vo.QueryRoleVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RoleMapper {

    @Select("select * from system_role")
    List<Role> getList(QueryRoleVO queryRoleVO);

    @Insert(" insert into system_role (role_name,remark) values (#{roleName}, #{remark})")
    @Options(useGeneratedKeys = true,keyProperty = "roleId")
    void insert(Role role);

    @Update("update system_role set role_name = #{roleName} , remark = #{remark} where role_id = #{roleId}")
    void update(Role role);
}
